<?php
error_reporting(0);
session_start();
include_once '../comm/config.php';
include_once '../comm/checkpostandget.php';
include_once '../comm/wjt.php';
include_once 'check.php';

$q = "SELECT * FROM ".$BIAOTOU."user where ddusername='".$_SESSION["duoduouser"]."'";
$rs = mysql_query($q);
$row = mysql_fetch_object($rs);
$money=$row->money;
$jifen=$row->jifen;
$yitixian=$row->yitixian;
$zfb=$row->zfb;
$dengji=$row->dengji;
$txstate=$row->txstate;
$ddpassword=$row->ddpassword;

$sql="select ortheruserid from ".$BIAOTOU."apilogin where dduserid=".$_SESSION["dduserid"].' limit 1';
$rs = mysql_query($sql);
$row = mysql_fetch_object($rs);
$ortheruserid=$row->ortheruserid;

$name=$_SESSION['duoduouser'];
$sql="select addtime from ".$BIAOTOU."mingxi where ddusername='".$name."' and shijian='每日签到' order by Id desc";
$query=mysql_query($sql);
$row=mysql_fetch_array($query);
$addtime=$row['addtime'];
if($addtime<date('Y-m-d 00:00:00')){
	$sing=1;
}
else{
	$sing=0;
}

// 显示编辑页面，页面中包含 camera.swf
$uid = intval($_SESSION['dduserid']);
$urlAvatarMiddle = get_avatar_filepath($uid, $size = 'middle', $type = '');

//调用最新的兑换商品
$sql = "SELECT * FROM ".$BIAOTOU."dhlist where recommend=1 and hide=0 order by sort desc, addtime desc limit 5";
$dhlist = mysql_query($sql);


$tag="center";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<title>用户管理中心</title>
<!--<link href="../css/usercss.css" rel="stylesheet" type="text/css">-->
<link href="../template/<?=MOBAN?>/css/style.css" rel="stylesheet" type="text/css" />
<link  href="../template/<?=MOBAN?>/css/layout.css" rel="stylesheet" type="text/css" />
<link  href="../template/<?=MOBAN?>/css/comm.css" rel="stylesheet" type="text/css" />

<script type="text/javascript" src="../js/jquery.js"></script>
<script>
$(function(){
$('#sign').click(function(){
    $.post('../ajax.php?fun=sign',function(data){
	    if(data==1){
		    alert('签到完成');
			var money=parseFloat($('.content .userinfo .money').html());
			money=Math.floor(money * 100) / 100;
			$('.content .userinfo .money').html(money+<?=SIGNMONEY?>);
			$('.content .userinfo .jifen').html(parseInt($('.content .userinfo .jifen').html())+<?=SIGNJIFEN?>);
			$('#sign').text('签到完成');
		}
		else{
		    alert('您今天已经签到');
		}
	});
});
})
</script>
</head>
<body>
<?php
$modtag="center";
include("../template/".MOBAN."/header_user.tpl.php");
?>

<div class='layout_body'>

  <div class="uInfoTop">
     <div class="break"><a href="javascript:void();" onclick="javascript:window.history.back();"><img src="../template/<?=MOBAN?>/images/back.gif" width="29" height="30" border="0" /></a></div>
     <div class="username usernamefont"><?=$_SESSION["duoduouser"]?></div>
     <div class="userstate"><a class="ustatefont" href="exit.php">退出</a></div>
  </div>
  <div class="usertopline"></div>
  
<div class="clears"></div>
<div class="CreatL">
<ul>
<li><a href="tradelist.php?act=taobao">返米管理</a></li>
<li><a href="tuiguang_url.php"> 我要推广赚米</a></li>
<li><a href="baobei.php">我的晒吧</a></li>
<li><a href="huan.php">我的兑换</a></li>
</ul>
</div>
<div class="CreatR" style="width:800px;">
<dl class="myshopindex MarginB10">
<dt class="myshopIMG"><img src="../upload/avatar/<?=$urlAvatarMiddle?>" width="119" height="120" /></dt>
<dd>
<p><?php if($dengji<DENGJI1) echo "<img src=\"../images/v0.gif\"  alt=\"普通会员\" />";else if($dengji>=DENGJI1&&$dengji<DENGJI2) echo "<img src=\"../images/v1.gif\"  alt=\"黄金会员\"/>";else if($dengji>=DENGJI2&&$dengji<DENGJI3) echo "<img src=\"../images/v2.gif\" alt=\"白金会员\"  />";  else echo "<img src=\"../images/v3.gif\" alt=\"钻石会员\" />";?></p>
<p>可用米：<span class="ColorRed"><strong><?=$money*100?></strong></span>   <span class="MarginL10"> 等待返米：</span><span class="ColorRed"><strong>0</strong></span>   <span class="MarginL10">兑换中的礼品：</span><span class="ColorRed"><strong>0</strong></span></p>
<p><a href="../read.php?id=34" class="ColorRed">怎么样获得米？</a><!--<input name="" type="button" class="btn MarginT10" value="充米" />--></p>

</dd>
<!--<dd>
<ul class="shopstat_tag MarginL10">
<li class="tit"><img src="../template/<?=MOBAN?>/images/shopIndexbox_tit.gif" width="211" height="18" /></li>
<li>这里是您的店标，请立刻设置！</li>
<li><input name="" type="button" value="现在修改" class="but"></li>
</ul>
</dd>-->
</dl>
<div class="clears"></div>
<div class="TITline MarginT10">
<div class="x"></div>
</div>
<div class="clears"></div>
<ul class="shopstat">
<li>
  <h3>用米兑换礼品</h3></li>
<li>


<?php
 $i=1;
 while($dhlistrow=mysql_fetch_array($dhlist))
 {
	if($i<5)
	{
?>
<ul class="aboutgift" style="text-align:left;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:130px;">
<li style="width:128px;height:118px;background:#FFF"><a href="../huangou.php?id=<?=$dhlistrow['id']?>"><img src="<?=$dhlistrow["pic"]?>" width="126" height="115" class="" /></a></li>
<li style=""><a  href="../huangou.php?id=<?=$dhlistrow['id']?>"><?=$dhlistrow["name"]?></a><br /><span class="ColorRed"><?=($dhlistrow["money"]*100)?>米</span></li>
</ul>
<?php 
}
else
{?>
<ul class="aboutgift MarginR0" style="text-align:left;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:130px">
<li style="width:128px;height:118px;background:#FFF"><a href="../huangou.php?id=<?=$dhlistrow['id']?>"><img src="<?=$dhlistrow["pic"]?>" width="126" height="115" class="" /></a></li>
<li><a href="../huangou.php?id=<?=$dhlistrow['id']?>"><?=$dhlistrow["name"]?></a><br /><span class="ColorRed"><?=($dhlistrow["money"]*100)?>米</span></li>
</ul>
<div class="clears"></div>
</li>
</ul>	
<?php }$i++;}?>

<div class="clears"></div>
</li>
</ul>

<div class="clears"></div>
<div class="TITline MarginT10">
<div class="x"></div>
</div>
<div class="clears"></div>
<ul class="shopstat">
<li>
<h3><span class="color00">累积提现：</span>0元 </h3></li>
<?php
if($txstate!='1')
{
	if($money==0)
	{
    	echo "<li>您当前可提现 <font style=\"color:#F00\"><b>".$money."</b></font> 元，还差 <font style=\"color:#F00\"><b>".(TIXIANJE-$money)."</b></font> 元就可以提现了！";
	}
	elseif($money<TIXIANJE)
	{
		echo "<li>您当前可提现  <font style=\"color:#F00\"><b>".$money."</b></font> 元，还差  <font style=\"color:#F00\"><b>".(TIXIANJE-$money)."</b></font> 元就可以提现了！";
	}
	else
	{
		echo "<li>您当前的账户余额是 <em>".$money."</em> 元，可以申请提现了 <input name=\"\" type=\"button\" class=\"btn MarginT10\" value=提现 onclick=\"window.location='tixian.php'\"></li>";
	}
}
?>
<?php
if($txstate=='1')
{
	echo '<li><p>您当前有一笔提现申请正在处理当中，我们将支付到您的支付宝中，请注意查收！<a href=mingxilist.php?act=out class="ColorRed">查看详细>></A></p></li>';
}
?>
<li><p>&nbsp;</p>
<p>注意事项：</p>
<p>当您帐户金额达到<?=TIXIANJE?>元时就可以申请提现了，提现金额必须是10或者10的倍数。
提交提现申请后，我们会在每月20日统一把钱支付到您填写的支付宝收款帐号里。</p>
<p>便于核对帐号，请留真实姓名</p></li>
</ul>
<p>&nbsp;</p>

<ul class="shoucheng">
<li>近一年攒米<br />
<p class="ColorRed"><strong>3200000</strong></p></li>
<li><img src="../template/<?=MOBAN?>/images/shopjd.gif" width="726" height="81" /></li>
</ul>
<p>&nbsp;</p>
<p>&nbsp;</p>

</div>
<div class="clears"></div>
</div>

<div class="lineclear"></div>
<?php
include("../template/".MOBAN."/footer.tpl.php");
?>
</body>
</html>
